package cn.szq.concurrent.thread.threadLocal;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.stream.IntStream;

/**
 * @ClassName: ThreadLocalDemo1
 * @Description:
 * @Author: szq
 * @Date: 2021-10-18 08:20:35
 */
public class ThreadLocalDemo1 {

    public static void main(String[] args) {

        IntStream.rangeClosed(1, 10).forEach(t->{
            new Thread(()->{
                String date = new ThreadLocalDemo1().date(t);
                System.out.println(date);
            }).start();
            try {
                Thread.sleep(100);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        });
    }

    private String date(int i) {
        Date date = new Date(i * 1000);
        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("mm:ss");
        return simpleDateFormat.format(date);
    }
}
